package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.common.AreaControlVO;
import com.jwsoft.manager.common.vo.eduSyncIrs.EduSyncIrsBatchVO;
import com.jwsoft.manager.common.vo.eduSyncIrs.EduSyncIrsKeyVO;
import com.jwsoft.manager.common.vo.eduSyncIrs.EduSyncIrsQueryVO;
import com.jwsoft.manager.common.vo.eduSyncIrs.EduSyncIrsVO;
import com.jwsoft.manager.core.integration.BatchCallSjgxIntegration;
import com.jwsoft.manager.core.integration.EduSyncIrsIntegration;
import com.jwsoft.manager.core.integration.individuation.DyIrsSyncIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * irs数据异步同步管理网关
 *
 * @author chenzh
 * @since 2023-05-10
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "irs数据异步同步管理", description = "irs数据异步同步管理")
public class EduSyncIrsController {

    @Autowired
    public EduSyncIrsIntegration eduSyncIrsIntegration;
    @Autowired
    private DyIrsSyncIntegration dyIrsSyncIntegration;
    @Autowired
    private BatchCallSjgxIntegration batchCallSjgxIntegration;

    @Operation(summary = "irs数据异步同步管理分页查询",description = "irs数据异步同步管理分页查询")
    @PostMapping(value = "/eduSyncIrs0001", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<PageInfo<EduSyncIrsVO>> getList(@RequestBody @Validated EduSyncIrsQueryVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.getList(vo));
    }
    @Operation(summary = "东阳教育irs转发平台数据分页查询",description = "查询本地irs平台数据分页查询")
    @PostMapping(value = "/eduSyncIrs0011", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<PageInfo<EduSyncIrsVO>> getListIrs(@RequestBody @Validated EduSyncIrsQueryVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.getListIrs(vo));
    }
    @Operation(summary = "irs数据异步同步管理根据主键查询详情",description = "irs数据异步同步管理根据主键查询详情")
    @PostMapping(value = "/eduSyncIrs0002", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduSyncIrsVO> getById(@RequestBody @Validated EduSyncIrsKeyVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.getById(vo));
    }
    @Operation(summary = "根据主键查询东阳教育irs转发平台数据详情",description = "根据主键查询本地irs数据详情")
    @PostMapping(value = "/eduSyncIrs0010", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduSyncIrsVO> getByIdIrs(@RequestBody @Validated EduSyncIrsKeyVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.getByIdIrs(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "irs数据异步同步管理新增",description = "irs数据异步同步管理新增")
    @PostMapping(value = "/eduSyncIrs0004", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduSyncIrsVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSyncIrsVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.add(vo));
    }

    @Operation(summary = "irs数据异步同步管理新增批量",description = "irs数据异步同步管理新增批量")
    @PostMapping(value = "/eduSyncIrs0007", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduSyncIrsVO> addBatch(@RequestBody @Validated EduSyncIrsBatchVO vo) {
        eduSyncIrsIntegration.addBatch(vo);
        return AppResponse.successMsg("成功");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "irs数据异步同步管理修改",description = "irs数据异步同步管理修改")
    @PostMapping(value = "/eduSyncIrs0005", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<EduSyncIrsVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSyncIrsVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.edit(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "东阳教育转发irs平台数据异步同步管理修改",description = "东阳教育转发irs平台数据异步同步管理修改")
    @PostMapping(value = "/eduSyncIrs0012", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSyncIrsVO> editIrs(@RequestBody @Validated(value = {Validators.Edit.class}) EduSyncIrsVO vo) {
        return AppResponse.successData(eduSyncIrsIntegration.editIrs(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "irs数据异步同步管理删除",description = "irs数据异步同步管理删除")
    @PostMapping(value = "/eduSyncIrs0006", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse del(@RequestBody @Validated EduSyncIrsKeyVO vo) {
        eduSyncIrsIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "东阳教育转发irs平台数据异步同步管理删除",description = "东阳教育转发irs平台异步同步管理删除")
    @PostMapping(value = "/eduSyncIrs0013", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse delIrs(@RequestBody @Validated EduSyncIrsKeyVO vo) {
        eduSyncIrsIntegration.delIrs(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "重置发送到转发平台错误数据",description = "重置发送本地平台错误数据")
    @PostMapping(value = "/eduSyncIrs0008", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse resetSendFlag(@RequestBody @Validated AreaControlVO vo) {
        eduSyncIrsIntegration.resetSendFlag(vo);
        return AppResponse.successMsg("同步成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "重置同步转发平台错误数据",description = "重置同步本地平台错误数据")
    @PostMapping(value = "/eduSyncIrs0009", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse resetSyncFlag(@RequestBody @Validated AreaControlVO vo) {
        eduSyncIrsIntegration.resetSyncFlag(vo);
        return AppResponse.successMsg("同步成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "本地irs平台数据发送到省irs平台",description = "本地irs平台数据发送到省irs平台")
    @PostMapping(value = "/IRS330783001", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse sendIrsTaskData(@RequestBody AreaControlVO vo) {
        dyIrsSyncIntegration.sendIrsTaskData(vo);
        return AppResponse.successMsg("成功");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "重置东阳教育irs转发平台发送错误数据",description = "重置本地irs平台发送错误数据")
    @PostMapping(value = "/IRS330783002", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse resetSendError(@RequestBody AreaControlVO vo) {
        dyIrsSyncIntegration.resetSendError(vo);
        return AppResponse.successMsg("成功");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据发送到东阳教育irs转发平台",description = "数据发送到本地irs转发服务器")
    @PostMapping(value = "/batchCallSjgx0010", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse sendLocalIrsTaskData(@RequestBody AreaControlVO vo) {
        batchCallSjgxIntegration.sendLocalIrsTaskData(vo);
        return AppResponse.successMsg("成功");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "东阳教育irs转发平台发送缓存清除",description = "重置本地irs平台发送错误数据")
    @PostMapping(value = "/IRS330783004", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse clearSendCache(@RequestBody AreaControlVO vo) {
        dyIrsSyncIntegration.clearSendCache(vo);
        return AppResponse.successMsg("成功");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "将东阳教育irs转发平台上的户籍同步下来",description = "将东阳教育irs转发平台上的户籍同步下来")
    @PostMapping(value = "/batchCallSjgx0011", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse syncBatchHousehouldByLocal(@RequestBody AreaControlVO vo) {
        batchCallSjgxIntegration.syncBatchHousehouldByLocal(vo);
        return AppResponse.successMsg("成功");
    }
}
